package com.zx._10_设计模式.结构型模式.适配器模式;

public class VideoPlayAdapterImpl implements VideoPlayAdapter {

    public static void main(String[] args) {
        VideoPlayAdapter player = new VideoPlayAdapterImpl();
        player.play("卧虎藏龙.mp4");
        player.play("囧途.flv");
        player.play("abc.avi");
        player.play("gggg.3gp");
    }

    @Override
    public void play(String fileName) {
        if (fileName.endsWith(".mp4")) {
            new MP4Play().playMp4(fileName);
        } else if (fileName.endsWith(".avi")) {
            new AVIPlay().playAvi(fileName);
        } else if (fileName.endsWith(".flv")) {
            new FlvPlay().playFlv(fileName);
        } else {
            System.out.println("no support videl type : " + fileName);
        }
    }
}
